﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using EquipmentConfig.Class;

namespace EquipmentConfig
{
    public partial class PassWord1 : Form
    {
        MainForm mf;

        public PassWord1(MainForm mainForm)
        {
            InitializeComponent();
            mf = mainForm;
        }

        private void PassWord_Load(object sender, EventArgs e)
        {

        }

        /// <summary>
        /// 确定
        /// </summary>
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtPassWord.Text.Trim() == string.Empty)
            {
                Messages.ShowAlertDialog("请输入密码!", false);
                return;
            }

            string strPassWord = Security.EncryptDES(txtPassWord.Text.Trim(), Security.EncryptKey);
            if (strPassWord != Program.keyValue1)
            {
                Messages.ShowAlertDialog("管理员密码错误!", false);
                return;
            }

            mf.btnClearHisData.Visible = true;
            this.Close();
        }

        private void PassWord_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.Dispose();
        }
    }
}
